package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread lin=new Thread("马云"){
            @Override
            public void run() {
                System.out.println(getName()+"睡.....");
                try {
                    Thread.sleep(600000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+"睡眠被中断");
                }
                System.out.println(getName()+"醒");
            }
        };
        Thread thb=new Thread("逛街叫卖"){
            @Override
            public void run() {
                for (int i = 0; i < 5; i++) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(this.getName()+"卖烧饼了");
                }
                System.out.println(this.getName()+"卖完了收工");
                lin.interrupt();
            }
        };
        lin.start();
        thb.start();

    }
}
